package com.wakala.employment.fragment.other;

import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.wakala.employment.R;
import com.wakala.employment.core.BaseFragment;
import com.wakala.employment.databinding.FragmentUserGetIntegralBinding;
import com.xuexiang.xpage.annotation.Page;
import com.xuexiang.xpage.enums.CoreAnim;
import com.xuexiang.xui.widget.actionbar.TitleBar;

/**
 * A simple {@link Fragment} subclass.
 * Use the {@link UserGetIntegralFragment#} factory method to
 * create an instance of this fragment.
 */
@Page(anim = CoreAnim.none)
public class UserGetIntegralFragment extends BaseFragment<FragmentUserGetIntegralBinding> implements View.OnClickListener {

    private static String TAG= UserGetIntegralFragment.class.getSimpleName();

    private Handler mHandler = new Handler(Looper.getMainLooper());


    @NonNull
    @Override
    protected FragmentUserGetIntegralBinding viewBindingInflate(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, boolean attachToRoot) {
        return FragmentUserGetIntegralBinding.inflate(inflater, container, attachToRoot);
    }

    @Override
    protected TitleBar initTitle() {
        return super.initTitle().setTitle("获取积分");
    }

    @Override
    protected void initViews() {

    }

    @Override
    protected void initListeners() {
        super.initListeners();
        binding.btnToVip.setOnClickListener(this);
        binding.btnToChunzhi.setOnClickListener(this);
        binding.btnToInvite.setOnClickListener(this);
    }



    @Override
    public void onClick(View view) {
        int id = view.getId();
        if(id == R.id.btn_to_vip){
            //去升级vip
            openNewPage(MemberVipFragment.class);
        } else if (id == R.id.btn_to_chunzhi) {
            //去充值
            openNewPage(UserIntegralRechargeFragment.class);
        } else if (id == R.id.btn_to_invite) {
            //去邀请
            //TODO 打开个人名片页面，展示个人二维码，邀请好友
        }
    }

}